{include file="public/layout" /}

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page" style="box-shadow:none;">
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                {eq name='$main_lang' value='$admin_lang'}
                {eq name="$Think.const.CONTROLLER_NAME.'@attribute_add'|is_check_access" value="1"}
                <div class="fbutton">
                    <a href="javascript:void(0);" data-href="{:url('Product/attribute_add', array('typeid'=>$Request.param.typeid))}" onclick="openFullframe(this, '新增产品参数', '80%', '80%');">
                        <div class="add" title="新增参数">
                            <span><i class="layui-icon layui-icon-addition"></i>新增参数</span>
                        </div>
                    </a>
                </div>
                {/eq}
                {/eq}
            </div>
            <form id="searchForm" class="navbar-form form-inline" action="{:url('Product/attribute_index')}" method="get" onsubmit="layer_loading('正在处理');">
                {$searchform.hidden|default=''}
                <div class="sDiv">
                    <div class="sDiv2">  
                        <select name="typeid" class="select" style="margin:0px 5px;">
                            {$select_html|default=''}
                        </select>
                    </div>
                    <div class="sDiv2">
                        <input type="text" size="30" name="keywords" value="{$Request.param.keywords}" class="qsbox" placeholder="名称搜索...">
                        <input type="submit" class="btn" value="搜索">
                        <i class="fa fa-search"></i>
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0" style="width: 100%">
                    <thead>
                    <tr>
                        {eq name='$main_lang' value='$admin_lang'}
                        <th class="sign w40" axis="col0">
                            <div class="tc"><input type="checkbox" autocomplete="off" class="checkAll"></div>
                        </th>
                        {/eq}
                        <th abbr="article_title" axis="col3" class="w40">
                            <div class="tc">ID</div>
                        </th>
                        <th abbr="article_title" axis="col3">
                            <div style="padding-left: 10px;" class="tl">参数名称</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w120">
                            <div class="tc">字段名称</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w120">
                            <div class="tc">表单类型</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w120">
                            <div class="tc">所属栏目</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w100">
                            <div class="tc">更新时间</div>
                        </th>
                        <th axis="col1" class="w120">
                            <div class="tc">操作</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w60">
                            <div class="tc">排序</div>
                        </th>
                       
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table style="width: 100%;">
                    <tbody>
                    {empty name="list"}
                        <tr>
                            <td class="no-data" align="center" axis="col0" colspan="50">
                                <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                            </td>
                        </tr>
                    {else/}
                        {volist name="list" id="vo" key="k"}
                        <tr>
                            {eq name='$main_lang' value='$admin_lang'}
                            <td class="sign">
                                <div class="tc w40"><input type="checkbox" autocomplete="off" name="ids[]" value="{$vo.attr_id}"></div>
                            </td>
                            {/eq}
                            <td class="sort">
                                <div class="tc w40">
                                    {$vo.attr_id}
                                </div>
                            </td>
                            <td align="left" style="width: 100%">
                                <div class="tl" style="padding-left: 10px;">
                                    {eq name="$Think.const.CONTROLLER_NAME.'@attribute_edit'|is_check_access" value="1"}
                                    <a href="{:url('Product/attribute_edit',array('id'=>$vo['attr_id']))}">{$vo.attr_name}</a>
                                    {else /}
                                    {$vo.attr_name}
                                    {/eq}
                                </div>
                            </td>
                            <td>
                                <div class="w120 tc" style="white-space: nowrap;">{$vo.fieldname|default=''}</div>
                            </td>
                            <td>
                                <div class="w120 tc" style="white-space: nowrap;">
                                    {$attrInputTypeArr[$vo['attr_input_type']]|default=''}
                                </div>
                            </td>
                            <td>
                                <div class="w120 tc" style="white-space: nowrap;">{$vo.typename|default='<i class="red">数据出错！</i>'}</div>
                            </td>
                            <td>
                                <div class="w100 tc">
                                    {$vo.update_time|date='Y-m-d',###}
                                </div>
                            </td>
                            <td class="operation">
                                <div class="w120 tc">
                                    {eq name="$Think.const.CONTROLLER_NAME.'@attribute_edit'|is_check_access" value="1"}
                                    <a href="javascript:void(0);" data-href="{:url('Product/attribute_edit',array('id'=>$vo['attr_id']))}" class="btn blue" onclick="openFullframe(this, '编辑产品参数 ', '80%', '80%');">编辑</a>
                                    {/eq}
                                    {eq name="$Think.const.CONTROLLER_NAME.'@attribute_del'|is_check_access" value="1"}
                                    {eq name='$main_lang' value='$admin_lang'}
                                    <i></i>
                                    <a class="btn red"  href="javascript:void(0);" data-url="{:url('Product/attribute_del')}" data-id="{$vo.attr_id}" {eq name='$recycle_switch' value='1'} data-deltype="del" {else /} data-deltype="pseudo" {/eq} onClick="delfun(this);">删除</a>
                                    {/eq}
                                    {/eq}
                                    <!-- <a class="btn blue" href="javascript:void(0);" onclick="copyToClipBoard('{$vo.fieldname}', '{$vo.attr_id}', {$vo.attr_input_type|default='0'})">标签调用</a> -->
                                </div>
                            </td>
                            <td class="sort">
                                <div class="w60 tc">
                                    {eq name="$Think.const.CONTROLLER_NAME.'@attribute_edit'|is_check_access" value="1"}
                                    <input style="text-align: left;" type="text" onchange="changeTableVal('product_attribute','attr_id','{$vo.attr_id}','sort_order',this);"  size="4"  value="{$vo.sort_order}" />
                                    {else /}
                                    {$vo.sort_order}
                                    {/eq}
                                </div>
                            </td>
                           
                        </tr>
                        {/volist}
                    {/empty}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <div class="tDiv">
            <div class="tDiv2">
            {eq name='$main_lang' value='$admin_lang'}
                <div class="fbutton checkboxall">
                    <input type="checkbox" autocomplete="off" class="checkAll">
                </div>
                {eq name="$Think.const.CONTROLLER_NAME.'@attribute_del'|is_check_access" value="1"}
                <div class="fbutton">
                    <a onclick="batch_del(this, 'ids');" data-url="{:url('Product/attribute_del')}" data-deltype="pseudo">
                        <div class="add" title="批量删除">
                            <span>批量删除</span>
                        </div>
                    </a>
                </div>
                {/eq}
            {/eq}
            </div>
            <div style="clear:both"></div>
        </div>
        <!--分页位置-->
        {$page}
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $('input[name*=ids]').click(function(){
            if ($('input[name*=ids]').length == $('input[name*=ids]:checked').length) {
                $('.checkAll').prop('checked','checked');
            } else {
                $('.checkAll').prop('checked', false);
            }
        });
        $('input[type=checkbox].checkAll').click(function(){
            $('input[type=checkbox]').prop('checked',this.checked);
        });
    });
    
    $(document).ready(function(){

        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });

        $('#searchForm select[name=typeid]').change(function(){
            $('#searchForm').submit();
        });
    });

    /**
     * 代码调用js
     * @param id  id
     * @param limit 条数
     */
    function copyToClipBoard(fieldname, attr_id, attr_input_type) {
        var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px;">';
        var liststr = "eyou:attr name='name_"+attr_id+" /";
        contentdiv += '<dd>list标签/arclist标签/内容页：</dd>';
        contentdiv += '<dd><input type="text" style=" width:400px;margin-bottom:10px;" value="{'+liststr+'}"></dd>';

        var otherstr = "eyou:attr aid='文档ID' name='name_"+attr_id+" /";
        contentdiv += '<dd>其他调法：</dd>';
        contentdiv += '<dd><input type="text" style=" width:400px;margin-bottom:10px;" value="{'+otherstr+'}"></dd>';

        contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将相应标签复制并粘贴到对应模板文件中！</dd></dl></div>'
        layer.open({
            title: '标签调用',
            type: 1,
            skin: 'layui-layer-demo',
            area: ['480px', '330px'], //宽高
            content: contentdiv
        });
    }
</script>

{include file="public/footer" /}